package com.wx.chapter8.homework08;

/**
 * ClassName:HomeWork08
 * Package :com.wx.chapter8.homework08
 * Description :
 *
 * @Author : coder_mu
 * @Create : 2023/5/29 - 17:29
 */
public class HomeWork08 {
    public static void main(String[] args) {
//        BankAccount bankAccount = new BankAccount(10);
//        bankAccount.deposit(10);
//        bankAccount.withdraw(5);
//        System.out.println(bankAccount.getBalance());

//        CheckingAccount checkingAccount = new CheckingAccount(10);
////        checkingAccount.deposit(10);
//        checkingAccount.withdraw(2);
//        System.out.println(checkingAccount.getBalance());

        SavingsAccount savingsAccount = new SavingsAccount(10, 3, 0.5);
        //存款
//        savingsAccount.deposit(10);
//        savingsAccount.deposit(10);
//        savingsAccount.deposit(10);
//        savingsAccount.deposit(10);

        //取款
        savingsAccount.withdraw(10);//取款成功
        savingsAccount.withdraw(10);//失败 余额不足
        savingsAccount.withdraw(10);//失败 余额不足
        savingsAccount.withdraw(10);//失败 余额不足
        System.out.println(savingsAccount.getBalance() + savingsAccount.earnMonthlyInterest(savingsAccount.getBalance()));
    }
}
